import 'dart:async';

import 'package:flutter/material.dart';

class MyDialog extends Dialog {


  // 定时关闭的方法
  _timerClose(BuildContext context) {
    Timer.periodic(Duration(milliseconds: 3000), (t) {
      Navigator.pop(context);
      t.cancel(); // 关闭定时器
    });
  }

  @override
  Widget build(BuildContext context) {
    _timerClose(context);
    return Material(
        type: MaterialType.transparency, // 设置透明度
        child: Container(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Container(
                height: 200,
                width: 200,
                color: Colors.white,
                child: Column(
                  children: <Widget>[
                    Stack(
                      children: <Widget>[
                        Center(
                          child: Text('提示信息'),
                        ),
                        InkWell(
                          onTap: () {
                            Navigator.pop(context);
                          },
                          child: Align(
                            alignment: Alignment.topRight,
                            child: Icon(Icons.close),
                          ),
                        )
                      ],
                    ),
                    Divider(),
                    Container(
                      width: double.infinity,
                      child: Text('1111111'),
                    )
                  ],
                ),
              )
            ],
          ),
        ));
  }
}
